package com.steamedfish.auctionitemserver.feign.service;

import com.steamedfish.auctionitemserver.model.AuctionItemModel;
import com.steamedfish.auctionitemserver.service.elasticsearch.ElasticSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 高山福
 * @since 2021-03-17
 */
@RestController
@RequestMapping("/auctionitemserver/service/auctionItem")
public class AuctionItemService {

    @Autowired
    private ElasticSearchService elasticSearchService;

    @RequestMapping(value = "/get",method = RequestMethod.GET)
    public ResponseEntity<?> getAuctionItem(@RequestParam(value = "id") String id){

        AuctionItemModel auctionItemModel = elasticSearchService.getAuctionModelById(id);
        return ResponseEntity.ok(auctionItemModel);
    }
}